<%@ Page Language="C#" EnableEventValidation="false" MasterPageFile="~/Users/UserDefault.master" AutoEventWireup="true" CodeFile="ShoppingCart.aspx.cs" Inherits="ShoppingCart" Title="Shopping Cart" %>
<%@ MasterType VirtualPath="~/Users/UserDefault.master" %>

<asp:Content ID="MainContent" ContentPlaceHolderID="mainContent" Runat="Server">   
    
    <div style="text-align:left" class="sectiontitle">Shopping Cart</div>
    <p></p>     
    Review and update the quantity of the products added to the cart before proceeding to checkout, or continue shopping.            
    <p></p>
    
    <div style="text-align:right">
        <asp:LinkButton ID="lBtnClear" runat="server" onclick="lBtnClear_Click">Clear</asp:LinkButton>
    </div>    
    
    <asp:GridView ID="gvwOrderItems" runat="server" AutoGenerateColumns="False" 
        DataSourceID="objShoppingCart" Width="100%" DataKeyNames="Line" 
        OnRowDeleted="gvwOrderItems_RowDeleted" 
        OnRowCreated="gvwOrderItems_RowCreated" EnableViewState="false">
       <Columns>
          <asp:HyperLinkField DataTextField="Title" DataNavigateUrlFormatString="#" HeaderText="Product" >
             <HeaderStyle HorizontalAlign="Left" />
          </asp:HyperLinkField>
          <asp:BoundField HeaderText="Description" DataField="Description" />
          <asp:TemplateField HeaderText="Price" ItemStyle-Width="20%">
             <ItemTemplate>
                <div style="text-align: right">
                   <%# FormatPrice(Eval("UnitPrice")) %>
                </div>
             </ItemTemplate>

          <ItemStyle Width="20%"></ItemStyle>
          </asp:TemplateField>
          <%--<asp:TemplateField HeaderText="Handling Options">
            <ItemTemplate>
                <asp:DropDownList ID="ddlHandling" runat="server" AutoPostBack="true" EnableViewState="true">
                    <asp:ListItem Text="Select.." Value="-1"></asp:ListItem>
                    <asp:ListItem Text="Hold for Pickup" Value="0"></asp:ListItem>
                    <asp:ListItem Text="Ship to me" Value="1"></asp:ListItem>
                </asp:DropDownList>
            </ItemTemplate>
            <ItemStyle HorizontalAlign="Center" Width="20px" />
          </asp:TemplateField>--%>
          <asp:CommandField ButtonType="Link" DeleteText="<img src='../images/delete.gif' alt='Delete this' border='0' />" ShowDeleteButton="true" >
             <ItemStyle HorizontalAlign="Center" Width="20px" />
          </asp:CommandField>
       </Columns>
       <EmptyDataTemplate><b>The shopping cart is empty</b></EmptyDataTemplate>   
    </asp:GridView>
    <asp:ObjectDataSource ID="objShoppingCart" runat="server" SelectMethod="GetItems"
       TypeName="Ample.Web.CurrentUserShoppingCart" DeleteMethod="DeleteProduct" 
         OldValuesParameterFormatString="{0}" EnableViewState="false">
        <DeleteParameters>
            <asp:Parameter Name="line" Type="Int32" />
        </DeleteParameters>
    </asp:ObjectDataSource>
    <br />
    <asp:Panel runat="server" ID="panTotals">
        <div style="text-align: center; font-weight: bold; padding-top: 4px;">
           <table cellspacing="10px" align="center">
                <tr>
                    <td align="left">Subtotal</td>
                    <td align="right"><asp:Literal runat="server" ID="lblSubTotal" /></td>
                </tr>
                <%--<tr>
                    <td align="left">Shipping & Handling</td>
                    <td align="right"><asp:Literal runat="server" ID="lblShippingCost" /></td>
                </tr>--%>
                <tr>
                    <td align="left">GST/HST</td>
                    <td align="right"><asp:Literal runat="server" ID="lblGST" /></td>
                </tr>
                <tr>
                    <td align="left">PST/QST</td>
                    <td align="right"><asp:Literal runat="server" ID="lblPST" /></td>
                </tr>
                <tr>
                    <td align="left">Total</td>
                    <td align="right"><asp:Literal runat="server" ID="lblTotal" /></td>
                </tr>
           </table>
            <asp:LinkButton ID="lBtnSubOrder" runat="server" onclick="lBtnSubOrder_Click">Submit Order</asp:LinkButton>            
        </div>
    </asp:Panel>
</asp:Content>

